
package com.jsg.sl651.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 水库输水设备列表枚举
 */
@Getter
@AllArgsConstructor
public enum WaterConveyanceFacilityEnum {
    SPILLWAY_OVERFLOW_CHANNEL(0, "非常溢洪道"),
    NORMAL_OVERFLOW_CHANNEL(1, "正常溢洪道"),
    FLOOD_CHANNEL(2, "泄洪道（洞）"),
    IRRIGATION_CHANNEL(3, "灌溉洞（渠）"),
    POWER_CHANNEL(4, "发电（洞）"),
    WATER_SUPPLY_CHANNEL(5, "供水（渠）"),
    SEDIMENT_DISCHARGE_CHANNEL(6, "排沙孔"),
    LOCK_GATE(7, "船闸"),
    OTHER(8, "其他");

    private final int code;
    private final String name;

    public static WaterConveyanceFacilityEnum getEnum(int code) {
        for (WaterConveyanceFacilityEnum item : WaterConveyanceFacilityEnum.values()) {
            if (item.getCode() == code) {
                return item;
            }
        }
        return OTHER;
    }
}